< previous page page_118 next page >

Page 118
The lpszProgID parameter is a string that contains the program ID you are searching for. The pclsid parameter is a structure to load with the CLSID for the object.
Designing the Test Program
The test program used by this puzzle is very simple, but it is made up of four different files. Why? Because the puzzle obtains the CLSID for an object that is part of the puzzle itself.
How is this accomplished?
First, the puzzle must be an ActiveX server, because only ActiveX servers can expose objects. In this case, it is an ActiveX EXE server, because we want the program to run in stand-alone mode as well. Use the Components tab of the Project Properties dialog box to choose the Standalone start mode so that the program will run independently. Set the start-up object in the General tab to Sub Main, so that the following code from the modGUIDPuzzle module will run:
Sub main()
   frmShowGUID.Show
End Sub
The frmShowGUID form contains two label controls and implements the following code:
' GUID Puzzle
' Copyright © 1998 by Desaware Inc. All Rights Reserved

Option Explicit

Private Sub Form_Load()
   Dim obj As New GUIDObject
   Dim cid As CLSID
   Dim ciddesc As String
   Dim x As Long

   cid = obj.GetCLSID()

   ciddesc = Hex$(cid.Datal) & vbCrLf
   ciddesc = ciddesc & Hex$(cid.Data2) & vbCrLf
   ciddesc = ciddesc & Hex$(cid.Data3) & vbCrLf
   For x = 0 To 7
      ciddesc = ciddesc & GetDataString(VarPtr(cid.Data4(x)), 1) & " "
   Next x

 
< previous page page_118 next page >